package com.foton.orderserver.order;

import com.foton.bpc.all.config.annotion.BpcRefrence;
import com.foton.bq.service.api.order.OrderService;
import com.foton.bq.service.api.sms.SmsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.UUID;

/**
 * @Author RenPu
 * @Date 2023/6/12 14:51
 * @Version 1.0
 * @Description: 模拟订单服务，调用远程sms（短信服务进行发送短信）
 **/

@Service
public class OrderSmsImpl implements OrderService {

    //设置客户端调用方式为随机策略
    @BpcRefrence(loadBalance = "RandomLoadBalance")
    public SmsService smsService;


    @Override
    public String create(String orderContent) {

        System.out.println("订单创建成功：：：："+orderContent);
        String send = smsService.send("10086" + UUID.randomUUID(),
                orderContent);
        System.out.println("smsService调用结果：：："+send);
        return send;

    }
}
